<?php

declare(strict_types=1);

namespace App\Model;


/**
 * @property int $id
 * @property int $platform_id 支付通道ID
 * @property string $params_name 参数名称
 * @property string $params_key 参数key
 * @property string $params_value 参数value
 * @property int $params_status
 * @property int $create_time
 */
class ConfigPayPlatformParam extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'tb_config_pay_platform_params';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = [];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'platform_id' => 'integer', 'params_status' => 'integer', 'create_time' => 'integer'];

    /**
     * 获取支付通道参数
     * @param $payPlatformID
     * @return array
     */
    public static function getPlatformParam($payPlatformID)
    {
        return self::query()->where('params_status', 1)->where('platform_id', $payPlatformID)->pluck('params_value', 'params_key')->toArray();
    }
}
